#include "common.h"
#include "config.h"
+#define TEMPLATES_PATH "/org/gnome/extensions-tool/templates"
+
static char *
get_shell_version (GError **error)
{
}
-#define TEMPLATE_PATH "/org/gnome/extensions-tool/template"
static gboolean
-copy_extension_template (GFile *target_dir, GError **error)
+copy_extension_template (const char *template, GFile *target_dir, GError **error)
{
g_auto (GStrv) templates = NULL;
+ g_autofree char *path = NULL;
char **s;
- templates = g_resources_enumerate_children (TEMPLATE_PATH, 0, NULL);
+ path = g_strdup_printf (TEMPLATES_PATH "/%s", template);
+ templates = g_resources_enumerate_children (path, 0, NULL);
+
+ if (templates == NULL)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ "No template %s", template);
+ return FALSE;
+ }
+
for (s = templates; *s; s++)
{
g_autoptr (GFile) target = NULL;
g_autoptr (GFile) source = NULL;
g_autofree char *uri = NULL;
- uri = g_strdup_printf ("resource://%s/%s", TEMPLATE_PATH, *s);
+ uri = g_strdup_printf ("resource://%s/%s", path, *s);
source = g_file_new_for_uri (uri);
target = g_file_get_child (target_dir, *s);
return FALSE;
}
- if (!copy_extension_template (dir, &error))
+ if (!copy_extension_template ("plain", dir, &error))
{
g_printerr ("%s\n", error->message);
return FALSE;
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/extensions-tool">
- <file>template/extension.js</file>
- <file>template/stylesheet.css</file>
+ <file>templates/plain/extension.js</file>
+ <file>templates/plain/stylesheet.css</file>
</gresource>
</gresources>
+++ /dev/null
-/* extension.js
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-/* exported init */
-
-class Extension {
- constructor() {
- }
-
- enable() {
- }
-
- disable() {
- }
-}
-
-function init() {
- return new Extension();
-}
+++ /dev/null
-/* Add your custom extension styling here */
--- /dev/null
+/* extension.js
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+/* exported init */
+
+class Extension {
+ constructor() {
+ }
+
+ enable() {
+ }
+
+ disable() {
+ }
+}
+
+function init() {
+ return new Extension();
+}
--- /dev/null
+/* Add your custom extension styling here */